﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
namespace ITXHWEB.Controllers
{
    public partial class VVTLIEFController : ITXController
    { 
        [ChildActionOnly]
        public ActionResult SVVTVKP(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            VVTLIEFModel m = new VVTLIEFModel();
            m.TERMNO = app.TERMNO;
            m.VKPAUF = VKPAUF;
            if (!IsVKPReady)
            {
                m.REMARK = "请扫描有效的单号";
            }
            return PartialView(m);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult SVVTVKP(VVTLIEFModel model, string returnUrl)
        {
            try
            {
                ModelState.Clear();
                VKPAUF = model.VKPAUF.Trim();
                VVTLOAD(model); 
                MABF.IsVKPReady = IsVKPReady;
                MABF.CVVT.KRS = VKPAUF.Substring(0, 2);
                MABF.CVVT.LFD = VKPAUF.Substring(2, 6);
                MABF.CVVT.POS = VKPAUF.Substring(8, 3);
            }
            catch (Exception ex)
            {
                VKPAUF = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);
            //return RedirectToAction("ITXWB06", "ITXWB06", new { TempData = TempData });
            //return View(model);
        }
       
    }
}
